import { IPSSysBDModule } from './ipssys-bdmodule';
import { IPSSysBDPart } from './ipssys-bdpart';
import { IPSSysBDScheme } from './ipssys-bdscheme';
import { IPSSysBDTable } from './ipssys-bdtable';
import { IPSSysBDTableRS } from './ipssys-bdtable-rs';
import { IPSSysSFPlugin } from '../res/ipssys-sfplugin';
import { IPSSysModelGroup } from '../system/ipssys-model-group';
import { IPSSystemModule } from '../system/ipssystem-module';
import { PSModelObjectImpl } from '../psmodel-object-impl';

export class PSSysBDSchemeImpl extends PSModelObjectImpl implements IPSSysBDScheme {
  protected allpssysbdmodules: IPSSysBDModule[] | null = null;

  getAllPSSysBDModules(): IPSSysBDModule[] | null {
    if (this.allpssysbdmodules == null) {
      this.allpssysbdmodules = this.fillChildListModel(this.M.getAllPSSysBDModules, 'ba.IPSSysBDModule') as IPSSysBDModule[];
    }
    return this.allpssysbdmodules;
  }

  get allPSSysBDModules(): IPSSysBDModule[] | null {
    return this.getAllPSSysBDModules();
  }

  findPSSysBDModule(objKey: any): IPSSysBDModule | null {
    return this.getPSModel5('ba.IPSSysBDModule', this.getAllPSSysBDModules(), objKey) as IPSSysBDModule;
  }

  protected allpssysbdparts: IPSSysBDPart[] | null = null;

  getAllPSSysBDParts(): IPSSysBDPart[] | null {
    if (this.allpssysbdparts == null) {
      this.allpssysbdparts = this.fillChildListModel(this.M.getAllPSSysBDParts, 'ba.IPSSysBDPart') as IPSSysBDPart[];
    }
    return this.allpssysbdparts;
  }

  get allPSSysBDParts(): IPSSysBDPart[] | null {
    return this.getAllPSSysBDParts();
  }

  findPSSysBDPart(objKey: any): IPSSysBDPart | null {
    return this.getPSModel5('ba.IPSSysBDPart', this.getAllPSSysBDParts(), objKey) as IPSSysBDPart;
  }

  protected allpssysbdtablerss: IPSSysBDTableRS[] | null = null;

  getAllPSSysBDTableRSs(): IPSSysBDTableRS[] | null {
    if (this.allpssysbdtablerss == null) {
      this.allpssysbdtablerss = this.fillChildListModel(this.M.getAllPSSysBDTableRSs, 'ba.IPSSysBDTableRS') as IPSSysBDTableRS[];
    }
    return this.allpssysbdtablerss;
  }

  get allPSSysBDTableRSs(): IPSSysBDTableRS[] | null {
    return this.getAllPSSysBDTableRSs();
  }

  findPSSysBDTableRS(objKey: any): IPSSysBDTableRS | null {
    return this.getPSModel5('ba.IPSSysBDTableRS', this.getAllPSSysBDTableRSs(), objKey) as IPSSysBDTableRS;
  }

  protected allpssysbdtables: IPSSysBDTable[] | null = null;

  getAllPSSysBDTables(): IPSSysBDTable[] | null {
    if (this.allpssysbdtables == null) {
      this.allpssysbdtables = this.fillChildListModel(this.M.getAllPSSysBDTables, 'ba.IPSSysBDTable') as IPSSysBDTable[];
    }
    return this.allpssysbdtables;
  }

  get allPSSysBDTables(): IPSSysBDTable[] | null {
    return this.getAllPSSysBDTables();
  }

  findPSSysBDTable(objKey: any): IPSSysBDTable | null {
    return this.getPSModel5('ba.IPSSysBDTable', this.getAllPSSysBDTables(), objKey) as IPSSysBDTable;
  }

  get authClientId(): string {
    return this.M.authClientId;
  }

  get authClientSecret(): string {
    return this.M.authClientSecret;
  }

  get authMode(): 'NONE' | 'AUTHORIZATION_CODE' | 'PASSWORD' | 'CLIENT_CREDENTIALS' | 'IMPLICIT' | 'USER' | 'USER2' {
    return this.M.authMode;
  }

  get authParam(): string {
    return this.M.authParam;
  }

  get authParam2(): string {
    return this.M.authParam2;
  }

  get bDType(): 'MONGODB' | 'SOLR' | 'ES' | 'HBASE' | 'USER' | 'USER2' {
    return this.M.bDType;
  }

  get codeName(): string {
    return this.M.codeName;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  protected pssysmodelgroup: IPSSysModelGroup | null = null;

  getPSSysModelGroup(): IPSSysModelGroup | null {
    if (this.pssysmodelgroup != null) return this.pssysmodelgroup;
    const value = this.M.getPSSysModelGroup;
    if (value == null) {
      return null;
    }
    this.pssysmodelgroup = this.getPSModel4('system.IPSSysModelGroup', value, 'getPSSysModelGroup') as IPSSysModelGroup;
    return this.pssysmodelgroup;
  }

  get psSysModelGroup(): IPSSysModelGroup | null {
    return this.getPSSysModelGroup();
  }

  getPSSysModelGroupMust(): IPSSysModelGroup {
    const value = this.getPSSysModelGroup();
    if (value == null) {
      throw new Error('未指定系统模型组');
    }
    return value;
  }

  protected pssyssfplugin: IPSSysSFPlugin | null = null;

  getPSSysSFPlugin(): IPSSysSFPlugin | null {
    if (this.pssyssfplugin != null) return this.pssyssfplugin;
    const value = this.M.getPSSysSFPlugin;
    if (value == null) {
      return null;
    }
    this.pssyssfplugin = this.getPSModel4('res.IPSSysSFPlugin', value, 'getPSSysSFPlugin') as IPSSysSFPlugin;
    return this.pssyssfplugin;
  }

  get psSysSFPlugin(): IPSSysSFPlugin | null {
    return this.getPSSysSFPlugin();
  }

  getPSSysSFPluginMust(): IPSSysSFPlugin {
    const value = this.getPSSysSFPlugin();
    if (value == null) {
      throw new Error('未指定后台扩展插件');
    }
    return value;
  }

  protected pssystemmodule: IPSSystemModule | null = null;

  getPSSystemModule(): IPSSystemModule | null {
    if (this.pssystemmodule != null) return this.pssystemmodule;
    const value = this.M.getPSSystemModule;
    if (value == null) {
      return null;
    }
    this.pssystemmodule = this.getPSModel4('system.IPSSystemModule', value, 'getPSSystemModule') as IPSSystemModule;
    return this.pssystemmodule;
  }

  get psSystemModule(): IPSSystemModule | null {
    return this.getPSSystemModule();
  }

  getPSSystemModuleMust(): IPSSystemModule {
    const value = this.getPSSystemModule();
    if (value == null) {
      throw new Error('未指定系统模块');
    }
    return value;
  }

  get schemeTag(): string {
    return this.M.schemeTag;
  }

  get schemeTag2(): string {
    return this.M.schemeTag2;
  }

  get serviceParam(): string {
    return this.M.serviceParam;
  }

  get serviceParam2(): string {
    return this.M.serviceParam2;
  }

  get servicePath(): string {
    return this.M.servicePath;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get defaultMode(): boolean {
    return this.M.defaultMode != null ? this.M.defaultMode : false;
  }

  get cls(): string {
    return 'PSSysBDSchemeImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'IPSModelObject' || cls == 'IPSObject' || cls == 'ba.IPSBDScheme' || cls == 'ba.IPSSysBDScheme') return true;
    return super.instanceof(cls);
  }
}
